<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    .box{
      width: 1000px;
      height: 500px;
      background-color: skyblue;
      display:flex;
    }
    .box div{
        width: 20px;
        height: 20px;
    }
    .first{
      background-color: blue;
    }
    .second{
      background-color: red;
    }
    .third{
      background-color: green;
    }
    /*弹性布局的item属性是写在item的style里面*/
    /*flex-grow属性,在父容器有多余的空间时,flex-grow的值表示item在主轴上放大的比例*/
  </style>
</head>
<body>
  <div class="box">
    <div class="first" style="flex-grow:1">item1</div>
    <div class="second" style="flex-grow:2">item2</div>
    <div class="third" style="flex-grow:4">item3</div>
  </div>
</body>
</html>